﻿using System;
using System.Collections.Generic;

namespace TypeMockDemo
{
    public abstract class Person : DomainObject
    {
        public string FirstName { get; set; }

        public string LastName { get; set; }

        public string Title { get; set; }

        public string Email { get; set; }

        private IList<Address> addresses = new List<Address>();

        public IEnumerable<Address> Addresses
        {
            get { return this.addresses; }
        }

        public void AddAddress(Address address)
        {
            if (this.addresses.Contains(address))
            {
                throw new InvalidOperationException("The address is already in the collection.");
            }
            this.addresses.Add(address);
        }

        public void RemoveAddress(Address address)
        {
            if (!this.addresses.Contains(address))
            {
                throw new InvalidOperationException("The address is not in the collection.");
            }
            this.addresses.Add(address);
        }
    }
}